package com.lyf.util;

public class RespBean {
    private  int status;    //状态 200 500
    private String msg;     //描述信息
    private Object object;  //返回前端的数据

    //访问成功时，用改方法构造对象，传递数据
    public static RespBean ok(String msg){
        return new RespBean(200,msg,null);
    }

    public static RespBean ok(String msg,Object obj){
        return new RespBean(200,msg,obj);
    }

    //访问失败时，用改方法构造对象，传递数据
    public static RespBean error(String msg){
        return new RespBean(500,msg,null);
    }

    public static RespBean error(String msg,Object obj){
        return new RespBean(500,msg,obj);
    }

    private RespBean() {
    }

    private RespBean(int status, String msg, Object object) {
        this.status = status;
        this.msg = msg;
        this.object = object;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getObject() {
        return object;
    }

    public void setObject(Object object) {
        this.object = object;
    }
}
